package com.oromwin.repos.server.response.file;

import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;

import org.apache.commons.logging.Log;

import com.oromwin.repos.common.Logger;
import com.oromwin.repos.common.ReposException;
import com.oromwin.repos.common.helper.IOHelper;
import com.oromwin.repos.data.FileTable;
import com.oromwin.repos.server.response.NormalResponse;

public class InfoFileResponse extends NormalResponse {
    private Log log = Logger.getLog(InfoFileResponse.class);
    private FileTable fileTable = null;
    public InfoFileResponse() {
        
    }
    public void receive(DataInputStream dis) throws ReposException {
        try {
            Result = dis.readBoolean();
            Description = IOHelper.readUTF8(dis);
            String volumeId = IOHelper.readUTF8(dis);
            String mediaId = IOHelper.readUTF8(dis);
            String fileId = IOHelper.readUTF8(dis);
            String fileName = IOHelper.readUTF8(dis);
            String fileFormat = IOHelper.readUTF8(dis);
            File filePath = new File(IOHelper.readUTF8(dis));
            Long fileBytes = new Long(dis.readLong());
            String fileCategory = IOHelper.readUTF8(dis);
            Boolean fileStatus = new Boolean(dis.readBoolean());
            Boolean filePdfConvFlag = new Boolean(dis.readBoolean());
            Boolean fileCompressionFlag = new Boolean(dis.readBoolean());
            String fileCreateDate = IOHelper.readUTF8(dis);
            String fileUpdateDate = IOHelper.readUTF8(dis);
            fileTable = new FileTable(volumeId, mediaId, fileId, fileName, fileFormat, filePath, fileBytes, fileCategory, fileStatus, filePdfConvFlag, fileCompressionFlag, fileCreateDate, fileUpdateDate);
        } catch (IOException e) {
            throw ReposException.create(log, e);
        }
    }
    public FileTable getFileTable() {
        return fileTable;
    }
}
